import request from '@/utils/request'

// 查询设备信息列表
export function listDevice(query) {
  return request({
    url: '/device/device/list',
    method: 'get',
    params: query
  })
}

// 查询设备信息详细
export function getDevice(deviceId) {
  return request({
    url: '/device/device/' + deviceId,
    method: 'get'
  })
}

// 新增设备信息
export function addDevice(data) {
  return request({
    url: '/device/device',
    method: 'post',
    data: data
  })
}

// 修改设备信息
export function updateDevice(data) {
  return request({
    url: '/device/device',
    method: 'put',
    data: data
  })
}

// 删除设备信息
export function delDevice(deviceIds) {
  return request({
    url: '/device/device/' + deviceIds,
    method: 'delete'
  })
}

// 导出设备信息
export function exportDevice(query) {
  return request({
    url: '/device/device/export',
    method: 'post',
    params: query
  })
}

// 生成设备二维码
export function generateQrCode(deviceId) {
  return request({
    url: '/device/device/qrcode/' + deviceId,
    method: 'post'
  })
}

// 获取设备状态
export function getDeviceStatus(deviceId) {
  return request({
    url: '/device/device/status/' + deviceId,
    method: 'get'
  })
}

// 更新设备心跳
export function updateHeartbeat(deviceId) {
  return request({
    url: '/device/device/heartbeat/' + deviceId,
    method: 'post'
  })
}

// 获取设备统计信息
export function getDeviceStatistics() {
  return request({
    url: '/device/device/statistics',
    method: 'get'
  })
}
